-
Notifications
You must be signed in to change notification settings - Fork 92
Use naked fn and define all interrupts in Rust #49
Conversation
This removes the trampoline from an assembly file and moves it into Rust. Fixes #33 !
I have been waiting for this... Awesome.. |
Now, if you don't pass a body, we'll just assume it's not handled. Rock.
Wow, this is impressive! I really like the approach of combining naked functions with macros. Maybe you should fly more often ;) |
@phil-opp yup @steveklabnik should fly more often... 😆 waiting for next |
hahahah |
|
||
idt.set_isr(32, make_idt_entry!(isr32, { | ||
// timer, do nothing for now | ||
pic::eoi_for(32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay so, i added send_eoi_for
because i was getting compile errors. But now, this line is here and works. Must investigate...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a new commit that removes the other function. Guess it's not needed now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahaha what? Compiler just woke up on the wrong side of the bed this morning.
[[package]] | ||
name = "spin" | ||
version = "0.3.5" | ||
source = "registry+https://github.com/rust-lang/crates.io-index" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two spins? Is Cargo supposed to allow that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Cargo attempts to unify versions, but if it cannot, it will include both.
I will send a PR to update the versions to be the same; no reason for it, really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. I thought it would error. Well, learn something now every day!
Sooooo more "Steve is doing coding on a plane."
In #33, both @ticki and @eddyb suggested moving to
naked fn
s for the interrupt handlers. Given that Rust was so nice to implement this feature just for OSdev, why not?So I started hacking away. I realized that if I had the trampoline in Rust, I really didn't want to copy it over and over. But each function would need to be able to call into the right one... so a macro. So I started working on a macro-based solution... and then I thought, hmmm, this code seems familiar... and turns out, @Ericson2314 introduced me to this technique a few weeks ago. I guess it percolated in my brain until now. It's not the exact same code, but the same basic strategy: use a macro to generate an
IDTEntry
, and go from there.🎊